<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">信用卡广告位信息</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-fw fa-edit" update="@form"
                                         rendered="#{loanNewAdvertCreditCardInfoBean.isView()}"
                                         actionListener="#{loanNewAdvertCreditCardInfoBean.changeStatusToEdit()}"/>

                        <p:commandButton value="保存" icon="fa fa-save" update="@form"
                                         rendered="#{loanNewAdvertCreditCardInfoBean.isEdit()}"
                                         actionListener="#{loanNewAdvertCreditCardInfoBean.saveInfo()}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="card ui-g-12">
                    <div class="ui-g">
                        <div class="ui-g-12"><h3><b>信用卡广告位信息</b></h3></div>
                        <div class="ui-g-2">
                            <p:outputLabel value="平台"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectOneMenu value="#{loanNewAdvertCreditCardInfoBean.$.platform}"
                                             disabled="#{loanNewAdvertCreditCardInfoBean.isView()}">
                                <f:selectItem itemLabel="全部" itemValue=""/>
                                <f:selectItem itemLabel="通用" itemValue="0"/>
                                <f:selectItem itemLabel="安卓" itemValue="android" />
                                <f:selectItem itemLabel="ios" itemValue="ios" />
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="产品"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectCheckboxMenu id="multiple" value="#{loanNewAdvertCreditCardInfoBean.productArray}"
                                                  disabled="#{loanNewAdvertCreditCardInfoBean.isView()}"
                                                  label="prd" multiple="true"
                                                  filter="true" filterMatchMode="startsWith">
                                <f:selectItem itemLabel="通用" itemValue="9999" />
                                <f:selectItems value="#{loanNewAdvertCreditCardInfoBean.getCommProductIds()}"
                                               var="commProduct"
                                               itemLabel="#{commProduct.name}" itemValue="#{commProduct.productId}"/>
                            </p:selectCheckboxMenu>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="渠道"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectOneMenu filter="true" filterMatchMode="startsWith"
                                             value="#{loanNewAdvertCreditCardInfoBean.$.channel}"
                                             disabled="#{loanNewAdvertCreditCardInfoBean.isView()}">
                                <f:selectItems value="#{loanNewAdvertCreditCardInfoBean.getCommProductChannels()}"
                                               var="commChannel"
                                               itemLabel="#{commChannel.channelName}"
                                               itemValue="#{commChannel.channelCode}"/>
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="广告位"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectOneMenu value="#{loanNewAdvertCreditCardInfoBean.$.advertId}"
                                             disabled="#{loanNewAdvertCreditCardInfoBean.isView()}">
                                <f:selectItems
                                        value="#{loanNewAdvertCreditCardInfoBean.dictionaries[DictionaryCode.NEW_CREDIT_CARD_ADVERT]}"
                                        var="dic"
                                        itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="信用卡列表"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectOneMenu filter="true" filterMatchMode="startsWith"
                                             value="#{loanNewAdvertCreditCardInfoBean.$.cardId}"
                                             disabled="#{loanNewAdvertCreditCardInfoBean.isView()}">
                                <f:selectItems value="#{loanNewAdvertCreditCardInfoBean.creditCardInfoList}"
                                               var="card"
                                               itemLabel="#{card.cardName}" itemValue="#{card.id}"/>
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="跳转类型"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectOneMenu value="#{loanNewAdvertCreditCardInfoBean.$.redirectType}"
                                             disabled="#{loanNewAdvertCreditCardInfoBean.isView()}">
                                <f:selectItem itemLabel="详情页" itemValue="1"/>
                                <f:selectItem itemLabel="直接跳转" itemValue="2"/>
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="每天控量上限"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputNumber value="#{loanNewAdvertCreditCardInfoBean.$.upperLimit}"
                                           disabled="#{loanNewAdvertCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="排序"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputNumber value="#{loanNewAdvertCreditCardInfoBean.$.sort}"
                                           decimalPlaces="0"
                                           disabled="#{loanNewAdvertCreditCardInfoBean.isView()}"/>
                        </div>

                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
